{% extends 'sys_templates/public/base.html' %}
{% block content %}
    <xblock>
        <button class="layui-btn layui-btn-danger" onclick="delAll()"><i class="layui-icon">&#xe640;</i>批量删除</button>
        {% if title!='文档回收站' %}
        <button class="layui-btn layui-btn-normal" onclick="level_add('新建文档','{{ url_for('cms_bp.document_add') }}','','1000','')"><i
                class="layui-icon">&#xe608;</i>添加
        </button>
        {% endif %}
        <span class="x-right" style="line-height:40px;margin-right: 30px">共有数据：{{ data_s |count }} 条</span></xblock>
    <table class="layui-table">
        <thead>
        <tr>
            <th>
                <input type="checkbox" name="check_all" value=""> 全选
            </th>
            <th>
                文档标题
            </th>
            <th>
                发布状态
            </th>
            <th>
                所属栏目
            </th>
            <th>
                点击数
            </th>
            <th>
                发布时间
            </th>
            <th>
                操作
            </th>
        </tr>
        </thead>
        <tbody>
        {% for data in data_s %}
            <tr>
                <td>
                    <input type="checkbox" value="{{ data.id }}" name="checkbox"> ID:{{ data.id }}
                </td>
                <td>
                    {{ data.title[:30] }}{% if data.title|length>30 %}
                    ...
                    {% endif %}
                </td>
                <td>
                    {% if data.is_pass==1 %}审核通过{% else %}<span style="color: red;font-weight: bold">未审核通过</span>{% endif %}
                </td>
            <td>
                {{ data.pro.column_name }}
            </td>
            <td>{{ data.clicks }}</td>
            <td>{{ data.update_time }}</td>
                <td class="td-manage">
                    {% if title!='文档回收站' %}
                    <a href="javascript:;"
                       onclick="level_add('编辑-{{ data.title }}','{{ url_for('cms_bp.document_edit',id=data.id) }}','','1000','')" class="layui-btn layui-btn-xs but_style">
                        编辑
                    </a>
                    <a href="javascript:;" onclick="member_del(this,'{{ data.id }}')"
                        class="layui-btn layui-btn-xs layui-btn-danger but_style">
                        删除
                    </a>
                        <a href="{{ url_for('web_bp.article_article',uuid=data.uuid) }}" target="_blank"
                       class="layui-btn layui-btn-xs layui-btn-primary but_style">
                        预览
                    </a>
                        {% else %}
                        <a onclick="member_recover(this,'{{ data.id }}')" href="javascript:;" title="恢复" class="layui-btn layui-btn-xs but_style">
                            恢复
                        </a>
                        <a title="彻底删除" href="javascript:;" onclick="member_unset(this,'{{ data.id }}')" class="layui-btn layui-btn-xs layui-btn-danger but_style">
                            删除
                        </a>
                    {% endif %}
                </td>
            </tr>
        {% endfor %}
        </tbody>
    </table>
    {% if page.pages>1 %}
    <div class="layui-card-body ">
        <div class="page">
            <div>
            <a {% if page.has_prev %}class="next" href="{{ url_for(url) }}?page={{ page.prev_num }}" {% else %}class="layui-btn-disabled"{% endif %}>上一页</a>
                {% for pg in page.iter_pages(2,2,2,2) %}
                    {% if page.page==pg %}
                        <span class="current">{{ pg }}</span>
                    {% else %}
                        {% if pg %}
                        <a class="num" href="{{ url_for(url) }}?page={{ pg }}">{{ pg }}</a>
                        {% endif %}
                    {% endif %}
                {% endfor %}
            {% if not page.pages==page.page %}
            <a class="num" href="{{ url_for(url) }}?page={{ page.pages }}">最后一页</a>
                {% endif %}
                <a {% if page.has_next %}class="next" href="{{ url_for(url) }}?page={{ page.next_num }}" {% else %}class="layui-btn-disabled"{% endif %}>下一页</a>
            </div>
        </div>
    </div>
    {% endif %}
{% endblock %}